home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 March / Pc Users extra 6.iso / nostalgi / hc / amiga / utils / adfi.bas next >
Encoding:
BASIC Source File  |  1995-07-25  |  3.3 KB  |  102 lines

  1. REM     THIS PROGRAM IS FREEWARE!
  2. REM
  3. REM     This is a simple QBASIC program which is intended to be used with
  4. REM     the TRANSDISK program. Since there were no easy way to copy those
  5. REM     files directly from the COMx: port under MSDOS (i tried) i  wrote
  6. REM     this in couple of minutes.
  7. REM
  8. REM     Quick Operating instructions.
  9. REM
  10. REM     1) Connect your _AMIGA_ to your PC
  11. REM     2) Set the serial options from your amiga to 19200,8,N,1 or slower
  12. REM     3) Modify this source to meet the demands of the transfer
  13. REM        (On the line 2 after the begining of "opencom" subprogram)
  14. REM     4) Run the program
  15.  
  16. init:
  17.     DIM char$(1024)
  18.     ON ERROR GOTO errh
  19.     CLS
  20. PRINT "╔════════════════════════════════════════════════════════════════════╗"
  21. PRINT "║                Amiga Disk File Importer for MS-DOS                 ║"
  22. PRINT "║                 Copyright (c) 1996 Henry Mantere.                  ║"
  23. PRINT "║                    Version 1.1B - 08111996.002                     ║"
  24. PRINT "╚════════════════════════════════════════════════════════════════════╝"
  25.     GOTO main
  26.  
  27. errh:
  28.     err1 = ERR
  29.     IF allowerror = 0 THEN
  30.         LOCATE 2, 76: PRINT err1;
  31.         RESUME NEXT
  32.         allowerror = 1
  33.     ELSE
  34.         LOCATE 22, 1
  35.         PRINT "Unexpected runtime-error ("; err1; "). Program halted."
  36.         END
  37.     END IF
  38.  
  39. main:
  40.     INPUT "Enter Filename: "; filename$: filename$ = UCASE$(filename$)
  41.      GOSUB csl: LOCATE 22, 1: PRINT "Opening output file."
  42.     GOSUB openfile:
  43.      GOSUB csl: LOCATE 22, 1
  44.      PRINT "Waiting serial port to respond (responds when data send)."
  45.     GOSUB opencom:
  46.     LOCATE
  47.     LOCATE 7, 1: PRINT "  Bytes Received:"; count
  48.     LOCATE 8, 1: PRINT "     Bytes to go:"; 901120 - count
  49.     LOCATE 9, 1: PRINT "Transfer started: "; TIME$
  50.     LOCATE 10, 1: PRINT "    Current time: "; TIME$
  51.     WHILE count < 901120
  52.         count = count + 1024
  53.         FOR a = 0 TO 1023
  54.             char$(a) = INPUT$(1, 2)
  55.         NEXT
  56.         FOR a = 0 TO 1023
  57.             PRINT #1, char$(a);
  58.         NEXT
  59.         LOCATE 7, 1: PRINT "  Bytes Received:"; count
  60.         LOCATE 8, 1: PRINT "     Bytes to go:"; 901120 - count; "    "
  61.         LOCATE 10, 1: PRINT "    Current time: "; TIME$
  62.     WEND
  63.     BEEP: BEEP
  64.     GOSUB csl: LOCATE 22, 1: PRINT "Transfer operation complete."
  65.     END
  66.  
  67. openfile:
  68.     err1 = 0: allowerror = 0
  69.     OPEN filename$ FOR INPUT AS 1
  70.     IF err1 = 53 THEN
  71.         CLOSE 1
  72.         OPEN filename$ FOR OUTPUT AS 1
  73.     ELSE
  74.          GOSUB csl: LOCATE 22, 1
  75.          PRINT "File ("; filename$; ") already exists, ";
  76.         INPUT "overwrite (y/N)"; a$: a$ = UCASE$(a$)
  77.         IF a$ = "Y" THEN
  78.             CLOSE 1
  79.             OPEN filename$ FOR OUTPUT AS 1
  80.         ELSE
  81.             GOSUB csl: LOCATE 22, 1
  82.             PRINT "File ("; filename$; ") could not be opened for output."
  83.             END
  84.         END IF
  85.     END IF
  86.     RETURN
  87.  
  88. opencom:
  89.     err1 = 0: allowerror = 0
  90.     OPEN "com2:19200,N,8,1,BIN" FOR INPUT AS 2
  91. REM <Modify the line above, if needed>
  92.     IF err1 = 24 THEN
  93.                       GOSUB csl: LOCATE 22, 1
  94.                       PRINT "Timeout on serial port."
  95.                       GOTO opencom
  96.                  END IF
  97.     RETURN
  98.  
  99. csl:                  
  100.     LOCATE 22, 1: FOR a = 0 TO 78: PRINT " "; : NEXT: PRINT " "
  101.     RETURN
  102.